package com.test.thread;

import java.io.IOException;
import java.io.PipedInputStream;

public class ReadData {
	public void readMethod(PipedInputStream in){
		try {
			System.out.println("read:");
			byte[] byteArray = new byte[2];
			int readLength = in.read(byteArray);
			while(readLength != -1){
				String newdata = new String(byteArray,0,readLength);
				System.out.println("read:"+newdata);
				readLength = in.read(byteArray);
			}
			System.out.println();
			in.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
}
